<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>第三题</title>
</head>

<body>
    <script>
        let arr = ['1', '3', '5', '3', '5', '3', '8', '9']
        let obj = {}
        arr.map(item => {
            if (obj[item]) {
                obj[item] += 1
            } else {
                obj[item] = 1
            }
        })
        console.log(obj)
        let max = 0
        let index = 0
        for (let k in obj) {
            console.log(k);
            if (obj[k] > max) {
                index = k
                max = obj[k]
            }
        }
        console.log(`次数最多为${index},共${max}次`);
    </script>
</body>

</html>